package com.example.demo.thread.threadPool;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @author: htc
 * @date: Created in 15:05 2019/2/25.
 */
@Component
public class AsyncTask {
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());

    //generatorTaskAsyncPool即配置线程池的方法名，此处如果不写自定义线程池的方法名，会使用默认的线程池
    @Async("generatorTaskAsyncPool")
    public void doTask(int i) {
        logger.info("Task " + i + " started.");
    }
}